
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.Timer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Riso
 */
public class Slnko extends JLabel implements ActionListener {
//    ImageIcon slnko1 = new ImageIcon("img/slnko1.png");
//    ImageIcon slnko2 = new ImageIcon("img/slnko2.png");
    ImageIcon slnko1 = new javax.swing.ImageIcon(getClass().getResource("/img/slnko1.png"));
    ImageIcon slnko2 = new javax.swing.ImageIcon(getClass().getResource("/img/slnko2.png"));
    Timer t = new Timer(500, this);
    int pocitadlo=0;
    public Slnko(){
        this.setBounds(350, 10, 60, 60);
        this.setIcon(slnko1);
        t.start();
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(pocitadlo==0){
            this.setIcon(slnko2);
            pocitadlo++;
        }else {
        this.setIcon(slnko1);
        pocitadlo--;
        }
    }
}
